﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace MvcShop.Models
{
    public enum AdType
    {
        Text,
        Image
    }

    [MetadataType(typeof(AdsMetadata))]
    public partial class Ads
    { }

    public class AdsMetadata
    {
        public int AdsId { get; set; }

        [DisplayName("标识")]
        [Required(ErrorMessage="标识不能为空。")]
        [StringLength(50, ErrorMessage = "标识长度不能超过50字节。")]
        public string Mark { get; set; }

        [DisplayName("文字广告")]
        [StringLength(200, ErrorMessage = "文字广告长度不能超过200字节。")]
        public string Text { get; set; }

        [DisplayName("广告图片路径")]
        [StringLength(100, ErrorMessage = "广告图片路径长度不能超过100字节。")]
        [DataType(DataType.Url)]
        public string ImageUrl { get; set; }

        [DisplayName("广告链接路径")]
        [StringLength(200, ErrorMessage = "广告链接路径长度不能超过200字节。")]
        public string LinkUrl { get; set; }

        [Required]
        [DisplayName("是否启用")]
        public bool IsUsed { get; set; }

        [DisplayName("起始日期")]
        [DataType(DataType.DateTime)]
        [Required(ErrorMessage = "起始日期不能为空。")]
        public DateTime AddDate { get; set; }

        [DisplayName("结束日期")]
        [DataType(DataType.DateTime)]
        [Required(ErrorMessage = "结束日期不能为空。")]
        public DateTime EndDate { get; set; }
    }
    

    /// <summary>
    /// 广告位
    /// </summary>
    [MetadataType(typeof(AdPositionMetadata))]
    public partial class AdPosition
    { }

    public class AdPositionMetadata
    {
        public int AdPositionId { get; set; }

        [DisplayName("标识")]
        [Required(ErrorMessage = "标识不能为空。")]
        [StringLength(50, ErrorMessage = "标识长度不能超过50字节。")]
        public string Mark { get; set; }

        [DisplayName("类型")]
        [Required(ErrorMessage = "类型不能为空。")]
        [StringLength(50, ErrorMessage = "类型长度不能超过50字节。")]
        public string Type { get; set; }

        [DisplayName("详细描述")]
        [StringLength(100, ErrorMessage = "详细描述长度不能超过100字节。")]
        public string Description { get; set; }
    }

}
